<html>
<head><meta charset="utf-8"><title>what to call a crate with base traits? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html">what to call a crate with base traits?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204929258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929258">(Jul 24 2020 at 15:21)</a>:</h4>
<p>I have a little HTTP API client crate and I want to add some derive macros. However, I want to use some code from the crate when running the derive macro itself. To my knowledge, this requires splitting up my code into three pieces:</p>
<ol>
<li>The "base" traits and their implementations</li>
<li>The proc-macro crate (depends on 1)</li>
<li>The user entrypoint crate (depends on 1, will depend on 2 via feature flag)</li>
</ol>
<p>Normally I have a naming scheme of <code>foo</code> and <code>foo-derive</code> for 3 and 2, respectively. I don't have experience with naming 1, and I can't think of any similar crates that I could borrow from. My current thoughts are leaning towards <code>foo-traits</code>.</p>
<p>Are there any existing crates that have this pattern? Does <code>-traits</code> sound like a good idea?</p>



<a name="204929454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929454">(Jul 24 2020 at 15:23)</a>:</h4>
<p>/me still wants to make it possible to just have proc macros in the same crate</p>



<a name="204929480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929480">(Jul 24 2020 at 15:23)</a>:</h4>
<p>(servo and webrender have some <code>-traits</code>and <code>-api</code> crates IIRC)</p>



<a name="204929513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929513">(Jul 24 2020 at 15:23)</a>:</h4>
<p>I think I'd lean towards <code>-core</code> personally since <code>-traits</code> implies <em>just</em> traits but here you have impls too</p>



<a name="204929605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929605">(Jul 24 2020 at 15:24)</a>:</h4>
<p>And there is rand-core</p>



<a name="204929674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929674">(Jul 24 2020 at 15:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F/near/204929480">said</a>:</p>
<blockquote>
<p>(servo and webrender have some <code>-traits</code>and <code>-api</code> crates IIRC)</p>
</blockquote>
<p>Any idea what lives in the <code>-api</code> ones?</p>



<a name="204929764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204929764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204929764">(Jul 24 2020 at 15:26)</a>:</h4>
<p>not a super clear idea no, sorry -- <a href="https://github.com/servo/webrender/tree/master/webrender_api/src">https://github.com/servo/webrender/tree/master/webrender_api/src</a> and servo's -traits are here <a href="https://github.com/servo/servo/tree/master/components">https://github.com/servo/servo/tree/master/components</a></p>



<a name="204956923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/what%20to%20call%20a%20crate%20with%20base%20traits%3F/near/204956923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/what.20to.20call.20a.20crate.20with.20base.20traits.3F.html#204956923">(Jul 24 2020 at 19:29)</a>:</h4>
<p><code>-impl</code> is another choice, especially if these are internal details that the user shouldn't rely on</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>